<template>
  <el-dialog
    title="头像二维码"
    :visible="showCode"
    width="30%"
    @close="close"
  >
    <el-row
      type="flex"
      justify="center"
    >
      <canvas ref="ca" />
    </el-row>

  </el-dialog>

</template>

<script>
import qc from 'qrcode'
export default {
  props: {
    showCode: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    // 绘制二维码参数
    async draw (url) {
      // qc.toCanvas(canvas元素DOM对象, 二维码中存储的数据)
      await this.$nextTick()
      qc.toCanvas(this.$refs.ca, url)
    },
    close () {
      this.$emit('update:showCode', false)
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
